import React from 'react'
import { useResolvedPath } from 'react-router-dom'

export default function News() {

  const path = '/user?id=123&name=tom#qwe';
  const res = useResolvedPath(path);
  const search = res.search;

  console.log(search);      // ?id=1&name=tom
  
  const params = new URLSearchParams(search);
  console.log(params);
 
  const id = params.get('id');
  console.log("id = ", id);
  const name = params.get('name');
  console.log("name = ", name);
      
  return (
    <ul>
      <li>news001</li>
      <li>news002</li>
      <li>news003</li>
    </ul>
  )
}
